/*
 * @Author: your name
 * @Date: 2022-04-26 09:19:53
 * @LastEditTime: 2023-05-17 13:46:07
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \trace-source-web\src\api\tracing-source-code\tracing-source-code.js
 */
import xjaxios from "@/api/axios-source_trace";
import axioss from "@/api/axios";
// let organizationNo = sessionStorage.getItem('organizationNo');

export default {
  // 添加溯源配置编号
  traceCode(params) {
    return xjaxios.post("traceCodeConfig/add", params);
  },
  // 修改溯源配置编号
  editTraceCode(params) {
    return xjaxios.post("traceCodeConfig/edit", params);
  },
  // 删除溯源配置编号
  delTraceCode(params) {
    return xjaxios.post("traceCodeConfig/delListByNo", params);
  },
  // 获取溯源配置编号
  productTracePageList(params) {
    return xjaxios.post("traceCodeConfig/queryPageByCondition", params);
  },
  // 获取溯源配置编号条件查询
  productTraceCondition(params) {
    return xjaxios.post("traceCodeConfig/queryByCondition", params);
  },
  // 添加溯源配置编号
  traceNoList(params) {
    return xjaxios.post("tracingSourceCode/add", params);
  },
  // 获取溯源配置编号详细信息
  productTraceQuery(id) {
    return xjaxios.get(`traceCodeConfig/query?productTraceNo=${id}`);
  },
  /**
  * @description: 生产批次查询条件查询 *代表必填
  */
  productionBaselist(params) {
    return xjaxios.post("/trace/productionBaseInfo/queryByCondition", {
      ...params
    });
  },

  /**
  * @description: 手动生产批次查询条件查询 *代表必填
  */
  artificialProductionlist(params) {
    return xjaxios.post("/trace/artificialProductionBaseInfo/queryByCondition", {
      ...params
    });
  },
  /**
  * @description: 加工批次查询条件查询 *代表必填
  */
  machiningBaselist(params) {
    return xjaxios.post("/trace/machiningBaseInfo/queryByCondition", {
      ...params
    });
  },
  /**
  * @description: 生产批次查询条件查询 *代表必填
  */
  traceMapperlist(params) {
    return xjaxios.post("/trace/traceMapper/queryByBatchType", {
      ...params
    });
  },
  /**
  * @description: 导出溯源信息 *代表必填
  */
  traceNoPageList(params) {
    return xjaxios.post("/tracingSourceCode/queryPageByCondition", {
      ...params
    });
  },
  traceByCondition(params) {
    return xjaxios.post("/tracingSourceCode/queryByCondition", {
      ...params
    });
  },
  // 批量导出
  traceExcelAll(params) {
    return xjaxios.get(`/tracingSourceCode/queryExcelAll?organizationNo=${params.organizationNo}&traceCodeConfigNo=${params.traceCodeConfigNo}`, { responseType: 'arraybuffer' });
  },
  // https://gateway.matefarm.net/tracingSourceCode/queryExcelAll?organizationNo=4&productTraceConfigId=19
  traceExcel(params, e) {
    return xjaxios.get(`/tracingSourceCode/queryExcel1?organizationNo=${e}&traceNoList=${params}`, { responseType: 'arraybuffer' });
  },
  // 更新 溯源码打印设计
  update(params) {
    return axioss.put("/organization/organizationInfo/update", params);
  },
  // 获取 溯源码打印设计
  queryByOrganizationNo(id) {
    return axioss.get(`/organization/organizationInfo/queryByOrganizationNo?no=${id}`);
  }
}
